#nullable enable

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using PHMEE.EnergyEfficiency;
using Volo.Abp.Application.Dtos;

namespace PHMEE.Controllers.EnergyEfficiency;

/// <summary>
/// Shaft Power Meter 轴功率计
/// </summary>
[Route("api/cbm/shaft-power-meter")]
public class ShaftPowerMeterController : PHMEEController, IShaftPowerMeterAppService
{
    private readonly IShaftPowerMeterAppService _shaftPowerMeterAppService;
    
    public ShaftPowerMeterController(IShaftPowerMeterAppService shaftPowerMeterAppService)
    {
        _shaftPowerMeterAppService = shaftPowerMeterAppService;
    }
    
    // /// <summary>
    // /// 获取实时轴功率计采集数据
    // /// </summary>
    // /// <param name="vesselId"></param>
    // /// <returns></returns>
    // [Route("GetRealtimeShaftPowerMeterData")]
    // [HttpGet]
    // public Task<List<ShaftPowerMeterDto>> GetRealtimeShaftPowerMeterDataAsync(Guid vesselId)
    // {
    //     return _shaftPowerMeterAppService.GetRealtimeShaftPowerMeterDataAsync(vesselId);
    // }

    /// <summary>
    /// 获取轴功率计各参数的 Description 选项列表
    /// </summary>
    /// <param name="vesselId"></param>
    /// <returns></returns>
    [Route("GetDescriptions")]
    [HttpGet]
    public List<string> GetDescriptions(Guid vesselId)
    {
        return _shaftPowerMeterAppService.GetDescriptions(vesselId);
    }

    /// <summary>
    /// 查询轴功率计数据
    /// </summary>
    /// <param name="vesselId"></param>
    /// <param name="description"></param>
    /// <param name="startDateTime"></param>
    /// <param name="endDateTime"></param>
    /// <param name="skipCount"></param>
    /// <param name="maxResultCount"></param>
    /// <returns></returns>
    [Route("GetShaftPowerMeterData")]
    [HttpGet]
    public Task<PagedResultDto<ShaftPowerMeterDto>> GetShaftPowerMeterDataAsync(Guid vesselId, string? description,
        DateTime startDateTime, DateTime endDateTime, int skipCount, int maxResultCount)
    {
        return _shaftPowerMeterAppService.GetShaftPowerMeterDataAsync(vesselId, description, startDateTime, endDateTime, skipCount, maxResultCount);
    }
    
    /// <summary>
    /// 获取最新轴功率计采集数据
    /// </summary>
    /// <param name="vesselId"></param>
    /// <returns></returns>
    [Route("GetLatestShaftPowerMeterData")]
    [HttpGet]
    public Task<List<ShaftPowerMeterDto>> GetLatestShaftPowerMeterDataAsync(Guid vesselId)
    {
        return _shaftPowerMeterAppService.GetLatestShaftPowerMeterDataAsync(vesselId);
    }
}